﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UploadFilesPopup.aspx.cs" Inherits="Cms.Web.UI.Admin.TinyMCEIntegration.UploadFilesPopup" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <base id="baseTag" runat="server" />
    <script type="text/javascript" src="Admin/tiny_mce/tiny_mce_popup.js"></script>
    <link rel="stylesheet" type="text/css" href="Admin/Css/Buttons.css" />		
    <link rel="stylesheet" type="text/css" href="Admin/Css/Dialogs.css" />
    <script type="text/javascript" language="javascript" src="Admin/Js/CmsLib.js"></script>
    <script type="text/javascript" language="javascript" src="Admin/Js/Dialogs.js"></script>
    <script type="text/javascript" src="swfupload/swfupload.js"></script>
    <script type="text/javascript" src="swfupload/swfupload.cookies.js"></script>
    <script type="text/javascript" src="swfupload/swfupload.queue.js"></script>
    <script type="text/javascript" src="swfupload/Handlers.js"></script>
    <script type="text/javascript" src="swfupload/FileProgress.js"></script>
    <link type="text/css" rel="Stylesheet" href="Admin/Css/SwfUpload.css" />
    <style type="text/css">
        body 
        {
        	background-color: #f0f0ee; 
        	font-family: Tahoma, Arial, Sans-Serif;
	        font-size: 12px;
        }

        img
        {
	        border: none;
        }

        a, a:hover { color: #444455; }
        h1
        {
	        font-size: 20px;
	        font-weight: normal;
	        color: #000;
        }
        
        #overlay
        {
        	display: none;
        	position: absolute;
	        background-color: #ffffff;
            filter:alpha(opacity=70); 
            -moz-opacity: 0.70; 
            opacity: 0.70;
            width: 1px;
            height: 1px;        	
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div style="text-align: right;">
        <asp:hyperlink ID="hlCancel" runat="server" CssClass="orangeButton"><span><span><img src="Admin/Img/icons/delete.png" alt="" /><span><cms:LocalizedLiteral ID="llCancel" runat="server" /></span></span></span></asp:hyperlink>
    </div>
    <div id="listContainer" style="margin: 0px; margin-top: 6px; border: 1px solid #919b9c; padding: 10px; background-color: #fff;">
        <div style="margin-bottom: 10px;"><cms:LocalizedLiteral ID="llCurrentFolder" runat="server" />: <asp:Literal ID="litFolder" runat="server" /></div>

        <div id="SwfUploadPlaceholder"></div>
    
        <div id="divFileProgressContainer" style="font-family: Tahoma; font-size: 12px;"></div>

        <input id="btnCancel" type="button" value="Cancel Uploads" onclick="cancelQueue(upload1);" disabled="disabled" style="display: none; margin-left: 2px; height: 22px; font-size: 8pt;" />

        <div id="overwriteWarning" style="position: absolute; left: -10000px;">
            <p><cms:LocalizedLiteral ID="llOverwriteMessage" runat="server" />:</p>
            <p><span id="lblExistingFiles"></span></p>
            <p><cms:LocalizedLiteral ID="llOverwriteQuestion" runat="server" /></p>
        </div>

        <iframe id="ifrCheckFiles" runat="server" style="position: absolute; left: -10000px;"></iframe>
    </div>
        
    <script type="text/javascript">
        //<![CDATA[
        function showOverlay() {
            var queuedFiles = document.getElementById("queuedFiles");
            var overlay = document.getElementById("overlay");
            var mainBox = document.getElementById("mainBox");
            var selectFiles = document.getElementById("selectFiles");
            selectFiles.style.display = "none";
            overlay.style.left = iLib.Pos.FindX(queuedFiles) - iLib.Pos.FindX(mainBox) + "px";
            overlay.style.top = iLib.Pos.FindY(queuedFiles) - iLib.Pos.FindY(mainBox) + "px";
            overlay.style.width = queuedFiles.offsetWidth + "px";
            overlay.style.height = queuedFiles.offsetHeight + "px";
            overlay.style.display = "block";
        }

        var swfu;

        function initSwfUpload() {
            swfu = new SWFUpload({
                upload_url: "../ProcessUploadedFile.aspx",
                flash_url: "../SwfUpload/swfupload.swf",
                post_params: {
                    "ASPSESSID": "<%=Session.SessionID%>",
                    "FrediumAuth": "<% =Request.Cookies["FrediumAuth"] != null ? Request.Cookies["FrediumAuth"].Value : ""%>"
                },

				// Button settings
                button_placeholder_id: "SwfUploadPlaceholder",
                button_image_url: "../Img/UploadButtonSv.png",
				button_width: 123,
				button_height: 24,
				button_text: '<span class="orangeButtonText">Select files</span>',
				button_text_style: '.orangeButtonText {	font-family: Tahoma, Arial, Sans-serif; font-size: 12px; color: #444455; }',
				button_text_top_padding: 3,
				button_text_left_padding: 27,
				button_cursor: SWFUpload.CURSOR.HAND,
				button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,

				file_size_limit: "102400", // 100MB
				file_types: "*.*",
				file_types_description: "All Files",
				file_upload_limit: "10",
				file_queue_limit: "0",

				// Event Handler Settings (all my handlers are in the Handler.js file)
				file_dialog_start_handler: fileDialogStart,
				file_queued_handler: fileQueued,
				file_queue_error_handler: fileQueueError,
				file_dialog_complete_handler: fileDialogComplete,
				upload_start_handler: uploadStart,
				upload_progress_handler: uploadProgress,
				upload_error_handler: uploadError,
				upload_success_handler: uploadSuccess,
				upload_complete_handler: uploadComplete,

				custom_settings: {
				    progressTarget: "divFileProgressContainer",
                    cancelButtonId: "btnCancel"
				},
				// Debug Settings
				debug: false
            });
        }

        function validationCallback(status) {
            if (status == "ok") {
                startProcessingFiles();
            }
            else
                swfu.cancelQueue();              
        }

        iLib.Dom.AddListener(window, "load", initSwfUpload);
        
        //]]>
    </script>
    </form>
</body>
</html>
